from flask_jwt_extended import (create_access_token, get_jwt_identity, jwt_required, JWTManager)
import datetime
# from app.config import OperateYaml

# loader = OperateYaml().read_yaml()
# SECRET_KEY = loader['secret_key']

def create_token(payload):
    expiration = datetime.timedelta(hours=1)
    token = create_access_token(identity=payload, fresh=True, expires_delta=expiration)
    return token

# 测试
# payload = {'user_id': 123, 'username': 'example_user'}
# token = create_token(payload)
# print("JWT Token:", token)

# decoded_payload = decode_token(token)
# if decoded_payload:
#     print("Decoded Payload:", decoded_payload)
